import { Component, OnInit, Input } from '@angular/core';

import { AlertController } from '@ionic/angular';

import { HttpService } from 'src/app/shared/service/http.service';

@Component({
    selector: 'app-poster-call',
    templateUrl: './poster-call.component.html',
    styleUrls: ['./poster-call.component.scss'],
})
export class PosterCallComponent implements OnInit {
    @Input() tagData: any;
    constructor(private alertController: AlertController,private http: HttpService) { }
    ngOnInit() {
    }

    async call(mobile) {
        const alert = await this.alertController.create({
            header: this.tagData.data.nick_name,
            message: '铺铺旺 ' + mobile,
            buttons: [
                {
                    text: '取消',
                    role: 'cancel',
                    cssClass: 'secondary'
                }, {
                    text: '拨打',
                    handler: () => {
                        this.http.changeCallNumber(mobile);
                    }
                }
            ]
        });
        await alert.present();
    }

}
